<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>考勤机分布管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function checkinfo(){
			var num=$('input[type=checkbox][name=classroomid]:checked').length
			if(num!=1){
				$('#modals').modal('toggle')
				return false;
			}
		}
	</script>
	<%--<script src="${ctxStatic}/AdminLTE/plugins/jQuery/jquery-2.2.3.min.js"></script>--%>
	<%--<script src="${ctxStatic}/AdminLTE/bootstrap/css/bootstrap.min.css"></script>--%>
	<%--<script src="${ctxStatic}/AdminLTE/bootstrap/js/bootstrap.min.js"></script>--%>
</head>
<body>
<div class="modal fade" id="modals">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<%--<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>--%>
				<h4 class="modal-title">提示</h4>
			</div>
			<div class="modal-body">
				<p>一台考勤机只能选择一个教室</p>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/zhtj/dispatchclassroom/">考勤机分布列表</a></li>
		<li class="active"><a href="${ctx}/zhtj/dispatchclassroom/form?id=${dispatchclassroom.id}">考勤机分布<shiro:hasPermission name="zhtj:dispatchclassroom:edit">${not empty dispatchclassroom.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="zhtj:dispatchclassroom:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="dispatchclassroom" action="${ctx}/zhtj/dispatchclassroom/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
	<div class="container-fluid">
		<div class="row form-group">
			<label class="control-label col-xs-1">考勤机IP：</label>
			<div class="col-xs-3">
				<form:input path="machineip" htmlEscape="false" maxlength="50" class="form-control input-sm input-xlarge required"/>
			</div>
		</div>
	</div>
	<div class="container-fluid">

		<div class="row form-group">
			<label class="control-label col-xs-1">教室：</label>
			<div>
				<div style="margin-left: 8%">
					<div>西校区</div>
					<c:forEach items="${map['西校区']}" var="item">
						<input type="checkbox" name="classroomid" value="${item.id}">${item.name}&nbsp;
					</c:forEach>
				</div>
				<div style="margin-left: 8%">
					<div>东校区</div>
					<c:forEach items="${map['东校区']}" var="item">
						<input type="checkbox" name="classroomid"  value="${item.id}">${item.name}&nbsp;
					</c:forEach>
				</div>
				<div style="margin-left: 8%">
					<div>北校区</div>
					<c:forEach items="${map['北校区']}" var="item">
						<input type="checkbox" name="classroomid" value="${item.id}">${item.name}&nbsp;
					</c:forEach>
				</div>
			</div>
		</div>
	</div>
		<div class="row form-group">
            <div class="col-xs-offset-1">
                 <shiro:hasPermission name="zhtj:dispatchclassroom:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" onclick="return checkinfo()" value="保 存"/>&nbsp;</shiro:hasPermission>
			    <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
             </div>
        </div>
	</form:form>
</body>
</html>